
#ifndef _MEDIASTREAMSINKDIALOGDATA_H_INC_
#define _MEDIASTREAMSINKDIALOGDATA_H_INC_

#include <string>
#include <tisudshl.h>

namespace DSNS = _DSHOWLIB_NAMESPACE;

struct tContentType
{
	tContentType()
		: uncompressed( GUID_NULL ), name( L"Unspecified" )
	{
	}

	tContentType( std::wstring name_tmp, DSNS::tCodecPtr codec_tmp, GUID uncompressed_tmp )
		:  name( name_tmp ), codec( codec_tmp ), uncompressed( uncompressed_tmp )
	{
	}

	DSNS::tCodecPtr		codec;
	GUID				uncompressed;

	std::wstring		name;

	bool		isSupported( DSNS::tMediaStreamContainerPtr container ) const
	{
		if( codec != NULL ) {
			return container->isCustomCodecSupported( codec );
		}
		if( uncompressed != GUID_NULL ) {
            return container->isUncompressedSupported();
		}
		return true;
	}
};

class CMediaStreamSinkDialogData
{
public:
	CMediaStreamSinkDialogData( smart_ptr<DSNS::GrabberSinkType> pOldSink = 0 );

	smart_ptr<DSNS::MediaStreamSink>	createSink();
public:
	std::vector<std::wstring>	getContainerList();
    std::vector<std::wstring>	getAvailableContentTypeStringList() const;

	void						selectContainer( int index );
    void						selectContentTypeIndex( int index );

	tContentType				getSelectedContentType() const { return m_CurrentlySelectedContentType; }
    DSNS::tMediaStreamContainerPtr	getSelectedContainer() const;

	std::wstring				getPreferredFilenameExtension();

	void						setFilename( const std::wstring& name );
    std::wstring				getFilename() const { return m_FileName; }
private:
	void						init( smart_ptr<DSNS::MediaStreamSink> pOldSink );

    std::vector<tContentType>	getAvailableContentTypeList() const;

	DSNS::tMediaStreamContainerList m_ContainerList;

	tContentType					m_CurrentlySelectedContentType;
	std::vector<tContentType>		m_AllContentTypeItems;
private:
	DSNS::tFrameFilterList	m_filterList;
	int						m_selectedContainer;
	std::wstring			m_FileName;
};

#endif
